28 July 2023
The purpose of this presentation is to examine the relationship between indicators of good health and well-being, specifically targeting the reduction of deaths and illnesses caused by hazardous chemicals, air, water, soil pollution, and contamination.
The presentation will explore the significance of these indicators and potential strategies for achieving improvements in this area.
Public health impact
Addresses hazardous chemicals, pollution, and unsafe water’s effect on mortality and illness rates.
Sustainable Development Goals
Supports Goal 3 by focusing on reducing deaths and illnesses from pollution.
Policy implications
Informs targeted strategies to address health risks.
Well-being enhancement
Contributes to promoting healthier lives and well-being.
Health and water indicators are related to Goals 3 and 6.

Good Health and Well-being
There is a strong negative correlation between Mortality rate and Population with basic handwashing facilities
Considering the four selected Sustainable Development Goals, what is an appropriate number, \(\textit{k}\), of clusters for countries?

Elbow at 3, so we choose k=3
Can the cluster assignment be predicted based on the country’s income group, population size and region according to the 7-class World Bank categorisation?
The decision tree only considered the region variable for classification.
Relative importance of the predictors for classification are as follows:
For a single train-test split of [75 25], the model obtained a decent prediction accuracy of 0.7.
However, the accuracy for ten-fold cross validation was low, at 0.58. This is probably because the dataset is too small, and the model is overfitting. Overall, the model is unable to generalize to unseen data.
[1] 78
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:290:81: style: [line_length_linter] Lines should not be more than 80 characters.
main.title = "Population with basic handwashing facilities by Country for 2019"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:370:81: style: [line_length_linter] Lines should not be more than 80 characters.
"<br>Population with basic handwashing facilities (%): ", pop_with_basic_handwashing_facilites_2019,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:406:81: style: [line_length_linter] Lines should not be more than 80 characters.
"<br>Population with basic handwashing facilities (%): ", pop_with_basic_handwashing_facilites_2019,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:442:81: style: [line_length_linter] Lines should not be more than 80 characters.
"<br>Population with basic handwashing facilities (%): ", pop_with_basic_handwashing_facilites_2019,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:502:81: style: [line_length_linter] Lines should not be more than 80 characters.
"<br>Mortality Rate Unintentional Poisoning per 100,000: ", unintentional_poisoning_2019,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:541:81: style: [line_length_linter] Lines should not be more than 80 characters.
"<br>Mortality Rate Unintentional Poisoning per 100,000: ", unintentional_poisoning_2019,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:580:81: style: [line_length_linter] Lines should not be more than 80 characters.
"<br>Mortality Rate Unintentional Poisoning per 100,000: ", unintentional_poisoning_2019,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:600:81: style: [line_length_linter] Lines should not be more than 80 characters.
# Plots of Indicator between mortality rate and population with basic handwashing facilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:645:81: style: [line_length_linter] Lines should not be more than 80 characters.
title = "Correlation between Mortality Rate and Basic Handwashing Facilities \n for Both Gender",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:664:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf$pop_with_basic_handwashing_facilites_2019[countries_sf$area == "All areas"],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:669:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf$pop_with_basic_handwashing_facilites_2019[countries_sf$area == "Urban"],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:674:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf$pop_with_basic_handwashing_facilites_2019[countries_sf$area == "Rural"],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:705:81: style: [line_length_linter] Lines should not be more than 80 characters.
stacked_bar_chart <- ggplot(countries_sf, aes(x = unintentional_poisoning_2019, fill = area)) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:718:81: style: [line_length_linter] Lines should not be more than 80 characters.
grouped_bar_chart <- ggplot(countries_sf, aes(x = unintentional_poisoning_2019, fill = area)) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:733:81: style: [line_length_linter] Lines should not be more than 80 characters.
ggplot_stacked_bar_chart <- ggplotly(stacked_bar_chart, width = 1000, height = 600, autosize = TRUE)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:734:81: style: [line_length_linter] Lines should not be more than 80 characters.
ggplot_grouped_bar_chart <- ggplotly(grouped_bar_chart, width = 1000, height = 600, autosize = TRUE)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:745:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf$unintentional_poisoning_2019.positive <- countries_sf$unintentional_poisoning_2019 + abs(min(countries_sf$unintentional_poisoning_2019)) + 0.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:747:81: style: [line_length_linter] Lines should not be more than 80 characters.
bc_result <- MASS::boxcox(countries_sf$unintentional_poisoning_2019.positive ~ 1,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:756:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf$latest_value.x_bc <- log(countries_sf$unintentional_poisoning_2019.positive)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:758:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf$latest_value.x_bc <- (countries_sf$unintentional_poisoning_2019.positive^optimal_lambda - 1) / optimal_lambda
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:763:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf$latest_value.x_bc <- countries_sf$latest_value.x_bc + abs(min_value) + 0.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:773:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf$latest_value.x_bc_cat <- cut(countries_sf$latest_value.x_bc_rounded, breaks = 50)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:776:81: style: [line_length_linter] Lines should not be more than 80 characters.
stacked_bar_chart_bc <- ggplot(countries_sf, aes(x = latest_value.x_bc_rounded, fill = area)) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:789:81: style: [line_length_linter] Lines should not be more than 80 characters.
grouped_bar_chart_bc <- ggplot(countries_sf, aes(x = latest_value.x_bc_rounded, fill = area)) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:806:81: style: [line_length_linter] Lines should not be more than 80 characters.
plot_loess <- ggplot(countries_sf, aes(x = latest_value.x_bc, y = pop_with_basic_handwashing_facilites_2019)) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:835:81: style: [line_length_linter] Lines should not be more than 80 characters.
title = "Correlation between Mortality Rate and Basic Handwashing Facilities (Normalised) for Both Gender",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:855:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf$pop_with_basic_handwashing_facilites_2019[countries_sf$area == "All areas"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:860:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf$pop_with_basic_handwashing_facilites_2019[countries_sf$area == "Urban"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:865:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf$pop_with_basic_handwashing_facilites_2019[countries_sf$area == "Rural"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:909:81: style: [line_length_linter] Lines should not be more than 80 characters.
subplot <- subplot(ggplot_stacked_bar_chart, ggplot_grouped_bar_chart, nrows = 1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:916:81: style: [line_length_linter] Lines should not be more than 80 characters.
subplot_normalised <- subplot(ggplot_stacked_bar_chart_bc, ggplot_grouped_bar_chart_bc, nrows = 1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1024:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf_water_all <- countries_sf_water %>% filter(!(urbanisation %in% c("Rural", "Urban")))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1025:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf_water_urban <- countries_sf_water %>% filter(!(urbanisation %in% c("All area", "Urban")))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1026:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_sf_water_rural <- countries_sf_water %>% filter(!(urbanisation %in% c("Urban", "All areas")))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1034:1: style: [object_name_linter] Variable and function name style should be snake_case or symbols.
colorPalette <- colorRampPalette(c("#FF6969", "#00A0D6"))
^~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1038:1: style: [object_name_linter] Variable and function name style should be snake_case or symbols.
numBreaks <- 6
^~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1045:81: style: [line_length_linter] Lines should not be more than 80 characters.
fillColor = ~ colorNumeric(palette = colors, domain = c(0, 20, 40, 60, 80, 100))(value_2019),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1062:81: style: [line_length_linter] Lines should not be more than 80 characters.
"<br>Proportion of population access to safely managed drinking water service: ",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1083:1: style: [object_name_linter] Variable and function name style should be snake_case or symbols.
colorPalette <- colorRampPalette(c("#FF6969", "#00A0D6"))
^~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1087:1: style: [object_name_linter] Variable and function name style should be snake_case or symbols.
numBreaks <- 6
^~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1114:81: style: [line_length_linter] Lines should not be more than 80 characters.
"<br>Proportion of population access to safely managed drinking water service: ",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1134:1: style: [object_name_linter] Variable and function name style should be snake_case or symbols.
colorPalette <- colorRampPalette(c("#FF6969", "#00A0D6"))
^~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1138:1: style: [object_name_linter] Variable and function name style should be snake_case or symbols.
numBreaks <- 6
^~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1145:81: style: [line_length_linter] Lines should not be more than 80 characters.
fillColor = ~ colorNumeric(palette = colors, domain = c(0, 20, 40, 60, 80, 100))(value_2019),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1162:81: style: [line_length_linter] Lines should not be more than 80 characters.
"<br>Proportion of population access to safely managed drinking water service: ",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1182:1: style: [object_name_linter] Variable and function name style should be snake_case or symbols.
colorPalette <- colorRampPalette(c("#FFFFDF", "#FFEEAA", "#FFBB55", "#FF7700", "#FF4400"))
^~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1182:81: style: [line_length_linter] Lines should not be more than 80 characters.
colorPalette <- colorRampPalette(c("#FFFFDF", "#FFEEAA", "#FFBB55", "#FF7700", "#FF4400"))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1186:1: style: [object_name_linter] Variable and function name style should be snake_case or symbols.
numBreaks <- 6
^~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1193:81: style: [line_length_linter] Lines should not be more than 80 characters.
fillColor = ~ colorNumeric(palette = colors, domain = c(0, 20, 40, 60, 80, 100))(mortality_rate_unsafe_water),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1210:81: style: [line_length_linter] Lines should not be more than 80 characters.
"<br>Mortality Rate from Unsafe Sanitation and Water per 100,000: ", mortality_rate_unsafe_water
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1229:81: style: [line_length_linter] Lines should not be more than 80 characters.
merged_data <- merge(mortality_rate_unsafe_water, proportion_of_safe_water, by = c("geoAreaCode", "geoAreaName"))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1230:81: style: [line_length_linter] Lines should not be more than 80 characters.
merged_data <- merged_data[!is.na(merged_data$value_2019), ] # remove NA values for 2019
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1327:81: style: [line_length_linter] Lines should not be more than 80 characters.
stacked_bar_chart <- ggplot(merged_data, aes(x = latest_value.x, fill = location_desc)) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1340:81: style: [line_length_linter] Lines should not be more than 80 characters.
grouped_bar_chart <- ggplot(merged_data, aes(x = latest_value.x, fill = location_desc)) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1356:81: style: [line_length_linter] Lines should not be more than 80 characters.
merged_data_all <- subset(merged_data, location_desc == "All areas") # change to rural or urban if you want
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1382:81: style: [line_length_linter] Lines should not be more than 80 characters.
merged_data$latest_value.x_positive <- merged_data$latest_value.x + abs(min(merged_data$latest_value.x)) + 0.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1396:81: style: [line_length_linter] Lines should not be more than 80 characters.
merged_data$latest_value.x_bc <- (merged_data$latest_value.x_positive^optimal_lambda - 1) / optimal_lambda
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1401:81: style: [line_length_linter] Lines should not be more than 80 characters.
merged_data$latest_value.x_bc <- merged_data$latest_value.x_bc + abs(min_value) + 0.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1411:81: style: [line_length_linter] Lines should not be more than 80 characters.
merged_data$latest_value.x_bc_cat <- cut(merged_data$latest_value.x_bc_rounded, breaks = 50)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1414:81: style: [line_length_linter] Lines should not be more than 80 characters.
stacked_bar_chart_bc <- ggplot(merged_data, aes(x = latest_value.x_bc_rounded, fill = location_desc)) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1427:81: style: [line_length_linter] Lines should not be more than 80 characters.
grouped_bar_chart_bc <- ggplot(merged_data, aes(x = latest_value.x_bc_rounded, fill = location_desc)) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1472:81: style: [line_length_linter] Lines should not be more than 80 characters.
title = "Correlation between Transformed Mortality Rate and Water Services (Normalised)",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1544:81: style: [line_length_linter] Lines should not be more than 80 characters.
subplot <- subplot(ggplot_stacked_bar_chart, ggplot_grouped_bar_chart, nrows = 1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1551:81: style: [line_length_linter] Lines should not be more than 80 characters.
subplot_normalised <- subplot(ggplot_stacked_bar_chart_bc, ggplot_grouped_bar_chart_bc, nrows = 1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1561:81: style: [line_length_linter] Lines should not be more than 80 characters.
mr_unsafe_water_indicators <- read_csv("data/indicator_3.9.2.csv", show_col_types = FALSE)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1573:81: style: [line_length_linter] Lines should not be more than 80 characters.
# proportion-of-population-with-basic-handwashing-facilities-on-premises-by-urban-rural-percent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1634:81: style: [line_length_linter] Lines should not be more than 80 characters.
#| label: select specific columns for population with basic handwashing facilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1760:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_tb_subset <- dplyr::select(countries_tb, MR_poisoning, MR_unsafe_water, handwash_access, sanitation_access, urbanisation, country.x)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1768:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_tb_subset_corr4 <- dplyr::select(countries_tb_subset, MR_unsafe_water, MR_poisoning, handwash_access, sanitation_access, urbanisation, country.x)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1780:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_tb_subset_corr4$Urbanisation <- as.factor(countries_tb_subset_corr4$Urbanisation)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1814:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_tb_subset_corr4 <- dplyr::select(countries_tb_subset, MR_unsafe_water, MR_poisoning, handwash_access, sanitation_access, urbanisation)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1826:81: style: [line_length_linter] Lines should not be more than 80 characters.
countries_tb_subset_corr4$Urbanisation <- as.factor(countries_tb_subset_corr4$Urbanisation)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1829:81: style: [line_length_linter] Lines should not be more than 80 characters.
color_mapping <- c("All areas" = "red", "Urban" = "blue", "Rural" = "green") # Adjust to your actual factor levels and desired colors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:1974:81: style: [line_length_linter] Lines should not be more than 80 characters.
mutate(code = countrycode(country, origin = "country.name", destination = "wb"))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:2007:25: warning: [seq_linter] 1:nrow(...) is likely to be wrong in the empty edge case. Use seq_len(nrow(...)) instead.
shuffle_index <- sample(1:nrow(dataset))
^~~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:2068:13: warning: [seq_linter] 1:length(...) is likely to be wrong in the empty edge case. Use seq_along(...) instead.
for (i in 1:length(labs)) {
^~~~~~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:2108:1: style: [object_name_linter] Variable and function name style should be snake_case or symbols.
confMatrix <- table(prediction, test$cluster)
^~~~~~~~~~
C:\Users\GOH BOON CHUN\Documents\GitHub\csc3007-cyan2\slides.qmd:2129:3: style: [commented_code_linter] Commented code should be removed.
# tune_grid = expand.grid(cp=c(0.0001)) # complexity parameter (size of tree)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~